package com.cqan.box.controller;

import static com.cqan.common.ViewName.*;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cqan.box.entity.UserBox;
import com.cqan.box.service.UserBoxService;
import com.cqan.controller.BaseController;
import com.cqan.orm.PropertyFilter;

@Controller
@RequestMapping("/userBox")
public class UserBoxController extends BaseController<UserBox> {

	@Resource
	private UserBoxService userBoxService;
	
	@RequestMapping(value="/list.htm")
	public ModelAndView list(Integer pageNo,HttpServletRequest request){
		ModelAndView mav = new ModelAndView(USER_BOX_LIST);
		List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
		page.setPageNo(pageNo);
		page = userBoxService.search(page, filters);
		mav.addObject("page", page);
		return mav;
	}
}
